home *** CD-ROM | disk | FTP | other *** search
/ Dynamic HTML Construction Kit / Dynamic HTML Construction Kit.iso / source_code / dhtmlunl / dhtml.exe / CD Content / Chap16 / dun16_7.txt < prev    next >
Encoding:
Text File  |  1997-12-18  |  1.0 KB  |  39 lines

  1. <HTML>
  2. <HEAD>
  3.   <TITLE>Displaying Context-Sensitive Menus Using Mouse Position</TITLE>
  4.   <STYLE>
  5.     .contextMenu  { position: absolute; background-color: #CCCCCC;
  6.                     font-family: arial, helvetica, sans-serif;
  7.                     font-size: 10pt; margin: 10; border: solid 1 gray; }
  8.   </STYLE>
  9.  
  10.   <SCRIPT>
  11.     function showDefaultMenu()
  12.     {
  13.       if (event.ctrlKey)
  14.       {
  15.         document.all.defaultMenu.style.left = event.x;
  16.         document.all.defaultMenu.style.top = event.y;
  17.         document.all.defaultMenu.style.display = "";
  18.       }
  19.     }
  20.  
  21.     function hideDefaultMenu()
  22.     {
  23.       document.all.defaultMenu.style.display = "none";
  24.     }
  25.   </SCRIPT>
  26. </HEAD>
  27.  
  28. <BODY onMouseDown="showDefaultMenu();" onMouseUp="hideDefaultMenu();">
  29. <H2>Displaying Context-Sensitive Menus Using Mouse Position</H2>
  30.  
  31. <DIV ID=defaultMenu CLASS=contextMenu STYLE="display: none; width: 100;">
  32. Cut<BR>
  33. Copy<BR>
  34. Paste<BR>
  35. </DIV>
  36.  
  37. </BODY>
  38. </HTML>
  39.